package ru.acme.lab11.domain.bank;

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import ru.acme.lab11.domain.client.Client;
import ru.acme.lab11.domain.client.ImmutableClient;
import ru.acme.lab11.exceptions.ClientExistsException;

public class Bank implements ImmutableBank {
	
	private List<Client> clients = new ArrayList<Client>(); 
			
	public void addClient(Client client) throws ClientExistsException {
		if (clients.contains(client)) {
			throw new ClientExistsException();
		}
		clients.add(client);
	}

	public List<? extends ImmutableClient> getImmutableClients() {
		return Collections.unmodifiableList(clients);
	}

	public List<Client> getClients() {
		return Collections.unmodifiableList(clients);
	}

}
